package com.mall.product.service;

import com.mall.common.core.text.Convert;
import com.mall.common.utils.DateUtils;
import com.mall.product.domain.entity.ProSize;
import com.mall.product.mapper.ProSizeMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 尺码Service业务层处理
 *
 * @author zhonglin
 * @date 2020-04-29
 */
@Service
public class ProSizeService {

  @Autowired
  private ProSizeMapper proSizeMapper;

  /**
   * 查询尺码
   *
   * @param sizeId 尺码ID
   *
   * @return 尺码
   */
  public ProSize selectProSizeById(Long sizeId) {

    return proSizeMapper.selectProSizeById(sizeId);
  }

  /**
   * 查询尺码列表
   *
   * @param proSize 尺码
   *
   * @return 尺码
   */
  public List<ProSize> selectProSizeList(ProSize proSize) {

    return proSizeMapper.selectProSizeList(proSize);
  }

  /**
   * 新增尺码
   *
   * @param proSize 尺码
   *
   * @return 结果
   */
  public int insertProSize(ProSize proSize) {

    proSize.setCreateTime(DateUtils.getNowDate());
    return proSizeMapper.insertProSize(proSize);
  }

  /**
   * 修改尺码
   *
   * @param proSize 尺码
   *
   * @return 结果
   */
  public int updateProSize(ProSize proSize) {

    proSize.setUpdateTime(DateUtils.getNowDate());
    return proSizeMapper.updateProSize(proSize);
  }

  /**
   * 删除尺码对象
   *
   * @param ids 需要删除的数据ID
   *
   * @return 结果
   */
  public int deleteProSizeByIds(String ids) {

    return proSizeMapper.deleteProSizeByIds(Convert.toStrArray(ids));
  }

  /**
   * 删除尺码信息
   *
   * @param sizeId 尺码ID
   *
   * @return 结果
   */
  public int deleteProSizeById(Long sizeId) {

    return proSizeMapper.deleteProSizeById(sizeId);
  }

}
